Complex Domain Novelty Function

This project is an implementation of the Complex Domain Novelty Function, or the Complex Domain Onset Detection Function

Refer to the literature Fundamentals of Music Processing (Meinard Muller, 2015) for detailed explanations.

load music file

calculate the STFT

Spectrum of the STFT

Raw Spectrogram (Amplitude)

Logarithm Spectrogram

Calculate the amplitude and the phase

Prediction of STFT frames & magnitude difference

Magnitude Difference

Calculate difference in EACH frequency bin.

Given that the diff is complex, we calculate the abs value, but half-wave rectify for those in which actual amplitude is smaller than expected

Onset Strength

Difference of those in which the expected is smaller than actual magnitude

Offset Strength

Vice Versa

Sum up the rectified frequency bins' difference

We use two approach here, one is the simple sum of all onset strength in each frequency bins. The other is we take the sum of squared strength of each frequency bins, and take its square root.

The plot looks like this

Moving average

This is important for peak-picking. You can see how different tracks need different M value for averaging.

Now we subtract the CD novelty with local average

Plots

Here we compare with the librosa.onset.onset_strength(), which uses Spectral Flux to calculate onset strength

Peak above the average value are picked.

Audio Evaluation

Compare CD Novelty to Spectral Flux Novelty